package com.example.meitao.ui;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Window;

import com.example.meitao.R;
import com.example.meitao.fragment.GoShopFragment;
import com.example.meitao.fragment.ShopFragment;
import com.example.meitao.gongjubao.DragLayout;

public class GoShopingActivity extends AppCompatActivity {
    private GoShopFragment fragment1;
    private ShopFragment fragment3;
    private DragLayout draglayout;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_go_shoping);

        initView();
    }

        private void initView() {
            fragment1 = new GoShopFragment();
            fragment3 = new ShopFragment();

            getSupportFragmentManager().beginTransaction()
                    .add(R.id.first, fragment1).add(R.id.second, fragment3)
                    .commit();

            DragLayout.ShowNextPageNotifier nextIntf = new DragLayout.ShowNextPageNotifier() {
                @Override
                public void onDragNext() {
                    fragment3.initShow();
                }
            };
            draglayout = (DragLayout) findViewById(R.id.draglayout);
            draglayout.setNextPageListener(nextIntf);
        }

}
